
<jsp:include page="menu.jsp" ></jsp:include>
		
 <div id="page-wrapper">
	 <div class="ibody">			 
			<div class="jumbotron">
					<h1>Registro de visita</h1>
			</div>
			<div class="formGeneral">
				<form method="post" action="VisitaInsertarServlet" name ="fresidente" id ="fresidente" action="./">
				<div class="row">					
					<div class="col-md-2">
						<label>DNI del visitante:</label>
						<input type="text"  class="form-control" name="inputDNI" id="inputDNI">
					</div>							
				</div>
				<div class="row">					
					<div class="col-md-3">
						<label>Fecha:</label>
						<input type="date" class="form-control" name="inputFecha" id="inputFecha">
					</div>							
					<div class="col-md-2">
						<label>Hora:</label>
						<input type="time" class="form-control" name="inputHora" id="inputHora">
					</div>
				</div>
				<div class="row">					
					<div class="col-md-10">
						<label>Nombres y Apellidos del Visitante:</label>
						<input type="text" class="form-control" name="inputNombres" id="inputNombres">
					</div>													
				</div>
				<div class="row">					
						<label for="lbResidente" class="col-md-10 control-label">Residente:</label>
						<div class="col-sm-6" selectContainer>
							<select id="ltresidente" name="ltresidente" class="form-control">
								<%@page import="java.util.*, upc.condominio.modelo.Residente, etm.negocio.GestionResidente" %>
								<%
								GestionResidente negocio = new GestionResidente() ;
								Collection<Residente> arreglo = negocio.listar() ;
								if(arreglo != null) { 
									for(Residente x : arreglo) {
								%>
								<option value="<%= x.getIdResidente() %>"> <%=  x.getNombres() + "," + x.getApePaterno() + " " + x.getApeMaterno() %> </option>
								<% 	}
								}
								%>
							</select>
						</div>
				</div>

				
				 <div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<input type="submit" class="btn btn-primary" value="Aceptar"/>
						<input type="button" value="Cancelar" class="btn btn-default" onclick="window.location='VisitaLista.jsp' " />
					</div>	
				</div>
				</form>
	  		</div>	
		</div>			
	</div>			
 
	<script type="text/javascript">
  
		var horaActual = new Date();
		var hora = horaActual.getHours();
		var minute = horaActual.getMinutes();
		if (hora < 10) hora = "0" + hora;
		if (minute < 10) minute = "0" + minute;
		var date = new Date();
		var day = date.getDate();
		var month = date.getMonth() + 1;
		var year = date.getFullYear();
		if (month < 10) month = "0" + month;
		if (day < 10) day = "0" + day;
		var today = year + "-" + month + "-" + day;
		
		document.getElementById('inputFecha').value = today;
		document.getElementById('inputHora').value = hora + ":" + minute; 
		
	</script>

</body>
</html>    